{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.7.6"
    },
    "colab": {
      "name": "project.ipynb",
      "provenance": []
    },
    "accelerator": "GPU"
  },
  "cells": [
    {
      "cell_type": "code",
      "metadata": {
        "id": "3PF2myIVMPD3",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        ""
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "EASI3KYzK2QE",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 235
        },
        "outputId": "caea185f-599e-4d3e-fade-6dbacffb7a4f"
      },
      "source": [
        "!apt-get install -y -qq software-properties-common python-software-properties module-init-tools\n",
        "!add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null\n",
        "!apt-get update -qq 2>&1 > /dev/null\n",
        "!apt-get -y install -qq google-drive-ocamlfuse fuse\n",
        "from google.colab import auth\n",
        "auth.authenticate_user()\n",
        "from oauth2client.client import GoogleCredentials\n",
        "creds = GoogleCredentials.get_application_default()\n",
        "import getpass\n",
        "!google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL\n",
        "vcode = getpass.getpass()\n",
        "!echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret}\n"
      ],
      "execution_count": 5,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "E: Package 'python-software-properties' has no installation candidate\n",
            "Selecting previously unselected package google-drive-ocamlfuse.\n",
            "(Reading database ... 144465 files and directories currently installed.)\n",
            "Preparing to unpack .../google-drive-ocamlfuse_0.7.22-0ubuntu3~ubuntu18.04.1_amd64.deb ...\n",
            "Unpacking google-drive-ocamlfuse (0.7.22-0ubuntu3~ubuntu18.04.1) ...\n",
            "Setting up google-drive-ocamlfuse (0.7.22-0ubuntu3~ubuntu18.04.1) ...\n",
            "Processing triggers for man-db (2.8.3-2ubuntu0.1) ...\n",
            "Please, open the following URL in a web browser: https://accounts.google.com/o/oauth2/auth?client_id=32555940559.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&response_type=code&access_type=offline&approval_prompt=force\n",
            "··········\n",
            "Please, open the following URL in a web browser: https://accounts.google.com/o/oauth2/auth?client_id=32555940559.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&response_type=code&access_type=offline&approval_prompt=force\n",
            "Please enter the verification code: Access token retrieved correctly.\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "ptDlapGQK4Ge",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "!mkdir -p drive\n",
        "!google-drive-ocamlfuse drive"
      ],
      "execution_count": 6,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "3faikLzWK31m",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 35
        },
        "outputId": "2eefc785-7967-4303-846a-27314a213b8f"
      },
      "source": [
        "%cd /content/drive/Colab"
      ],
      "execution_count": 45,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "/content/drive/Colab\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "AZml10LSKx3-",
        "colab_type": "text"
      },
      "source": [
        "问题 \n",
        "\n",
        "1、transforms.Resize(256) 为什么是256,为什么val里面是224\n",
        "\n",
        "2、normalize可以单独写吗\n",
        "\n",
        "3、'label': int(self.img_list[idx][1])}    label怎么为0或1\n",
        "\n",
        "4、这个根目录好像没用，后面还要指定全路径\n",
        "![image.png](attachment:image.png)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "orih8GnQKx4C",
        "colab_type": "text"
      },
      "source": [
        "5、为什么testse要用val_transformer？\n",
        "\n",
        "val和test是类似的\n",
        "\n",
        "6、scale = (0.5,1.0))是干嘛的\n",
        "\n",
        "7、二分类交叉信息熵 通用的交叉信息熵\n",
        "\n",
        "8、pred.eq(target.long().view_as(pred)).sum().item()\n",
        "\n",
        "9、argmax"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "ZI2N4cv_Kx4D",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 71
        },
        "outputId": "f75dbf82-56e1-4053-c047-2f43819cbd55"
      },
      "source": [
        "import torch\n",
        "import numpy as np\n",
        "import torch.nn as nn\n",
        "import torch.optim as optim\n",
        "from torchvision import transforms\n",
        "# 在自定义的文件中进行导入\n",
        "from tools.dataload import CovidCTDataset\n",
        "\n",
        "# 按照通道标准化\n",
        "# 均值和方差是从imagenet训练集中抽样算出来的\n",
        "normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])\n",
        "\n",
        "# 图像增强\n",
        "\n",
        "\"\"\"\n",
        "scale是一个面积采样的范围，假如是一个100*100的图片，scale = (0.5,1.0)，采样面积最小是0.5*100*100=5000，采样图片的大小最小就是5000开方，最大面积就是原图大小100*100\n",
        "也就是说，先按照scale将给定图像裁剪，然后再按照给定的输出大小224进行缩放\n",
        "采用面积是在0.5~1中，也就是5000~10000中 随机裁剪\n",
        "\"\"\"\n",
        "train_transformer = transforms.Compose([\n",
        "    # 一开始不用resize或者resize到其他大小都是可以的                                    \n",
        "    transforms.Resize(256),\n",
        "    transforms.transforms.RandomResizedCrop((224), scale = (0.5,1.0)),\n",
        "    transforms.RandomHorizontalFlip(),\n",
        "    transforms.ToTensor(),\n",
        "    normalize\n",
        "])\n",
        "\n",
        "# val和test是类似的，训练的时候可以多一些增强，这里只做验证就可以\n",
        "val_transformer = transforms.Compose([\n",
        "    transforms.Resize(224),\n",
        "    transforms.CenterCrop(224),\n",
        "    transforms.ToTensor(),\n",
        "    normalize\n",
        "])\n",
        "\n",
        "batchsize = 32\n",
        "total_epoch = 10\n",
        "\n",
        "#数据加载\n",
        "# txt存储的是文件名，即索引\n",
        "trainset = CovidCTDataset(root_dir = './COVID-CT/', \n",
        "                          txt_COVID = './COVID-CT/data/COVID/trainCT_COVID.txt',\n",
        "                          txt_NonCOVID = './COVID-CT/data/NonCOVID/trainCT_NonCOVID.txt',\n",
        "                          transform = train_transformer)\n",
        "\n",
        "valset = CovidCTDataset(root_dir = './COVID-CT/', \n",
        "                          txt_COVID = './COVID-CT/data/COVID/valCT_COVID.txt',\n",
        "                          txt_NonCOVID = './COVID-CT/data/NonCOVID/valCT_NonCOVID.txt',\n",
        "                          transform = val_transformer)\n",
        "\n",
        "testset = CovidCTDataset(root_dir = './COVID-CT/', \n",
        "                          txt_COVID = './COVID-CT/data/COVID/testCT_COVID.txt',\n",
        "                          txt_NonCOVID = './COVID-CT/data/NonCOVID/testCT_NonCOVID.txt',\n",
        "                          transform = val_transformer)\n",
        "\n",
        "print('训练集：',trainset.__len__())\n",
        "print('验证集：',valset.__len__())\n",
        "print('测试集：',testset.__len__())"
      ],
      "execution_count": 112,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "训练集： 425\n",
            "验证集： 118\n",
            "测试集： 203\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "O11IOjSVlnjt",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        ""
      ],
      "execution_count": 112,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "RLg8IgmWl5Jg",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 449
        },
        "outputId": "b8936117-d911-47f0-c07b-ec557d78a6e2"
      },
      "source": [
        "trainset.__getitem__(0)"
      ],
      "execution_count": 113,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "{'img': tensor([[[-1.3815, -1.3644, -1.3644,  ..., -1.3473, -1.3987, -1.4158],\n",
              "          [-1.3987, -1.3815, -1.3644,  ..., -1.3815, -1.4158, -1.3987],\n",
              "          [-1.3815, -1.3815, -1.3815,  ..., -1.4158, -1.3987, -1.3987],\n",
              "          ...,\n",
              "          [-1.2788, -1.2617, -1.2617,  ..., -1.1247, -1.1760, -1.1760],\n",
              "          [-1.2274, -1.2617, -1.2274,  ..., -1.1418, -1.1760, -1.1589],\n",
              "          [-1.2103, -1.1932, -1.2103,  ..., -1.1932, -1.1932, -1.1760]],\n",
              " \n",
              "         [[-1.2829, -1.2654, -1.2654,  ..., -1.2479, -1.3004, -1.3179],\n",
              "          [-1.3004, -1.2829, -1.2654,  ..., -1.2829, -1.3179, -1.3004],\n",
              "          [-1.2829, -1.2829, -1.2829,  ..., -1.3179, -1.3004, -1.3004],\n",
              "          ...,\n",
              "          [-1.1779, -1.1604, -1.1604,  ..., -1.0203, -1.0728, -1.0728],\n",
              "          [-1.1253, -1.1604, -1.1253,  ..., -1.0378, -1.0728, -1.0553],\n",
              "          [-1.1078, -1.0903, -1.1078,  ..., -1.0903, -1.0903, -1.0728]],\n",
              " \n",
              "         [[-1.0550, -1.0376, -1.0376,  ..., -1.0201, -1.0724, -1.0898],\n",
              "          [-1.0724, -1.0550, -1.0376,  ..., -1.0550, -1.0898, -1.0724],\n",
              "          [-1.0550, -1.0550, -1.0550,  ..., -1.0898, -1.0724, -1.0724],\n",
              "          ...,\n",
              "          [-0.9504, -0.9330, -0.9330,  ..., -0.7936, -0.8458, -0.8458],\n",
              "          [-0.8981, -0.9330, -0.8981,  ..., -0.8110, -0.8458, -0.8284],\n",
              "          [-0.8807, -0.8633, -0.8807,  ..., -0.8633, -0.8633, -0.8458]]]),\n",
              " 'label': 0}"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 113
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "1y0hZk_rmlMa",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "outputId": "23025281-0db2-42a7-9c8e-e22129c9a68a"
      },
      "source": [
        "trainset.img_list"
      ],
      "execution_count": 114,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "[['./COVID-CT/images/CT_COVID/2020.01.24.919183-p27-132.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.01.24.919183-p27-133.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.01.24.919183-p27-134.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.01.24.919183-p27-135.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.10.20021584-p6-52%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.10.20021584-p6-52%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.10.20021584-p6-52%10.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.10.20021584-p6-52%11.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.10.20021584-p6-52%12.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.10.20021584-p6-52%13.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.10.20021584-p6-52%14.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.10.20021584-p6-52%15.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.10.20021584-p6-52%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.10.20021584-p6-52%3.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.10.20021584-p6-52%4.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.10.20021584-p6-52%5.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.10.20021584-p6-52%6.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.10.20021584-p6-52%7.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.10.20021584-p6-52%8.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.10.20021584-p6-52%9.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.11.20021493-p16-109%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.11.20021493-p16-109%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.11.20021493-p16-109%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.11.20022053-p12-67%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.11.20022053-p12-67%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.11.20022053-p12-67%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.11.20022053-p12-67%3.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.13.20022673-p13-77%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.13.20022673-p13-77%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.13.20022673-p13-77%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.17.20024018-p17-61%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.17.20024018-p17-61%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.17.20024018-p17-61%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.17.20024018-p17-61%3.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.17.20024018-p17-61%4.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.19.20025023-p20-93%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.19.20025023-p20-93%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.19.20025023-p20-93%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.19.20025023-p20-93%3.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.22.20024927-p18-66%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.22.20024927-p18-66%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.22.20024927-p18-66%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.22.20024927-p19-68%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.22.20024927-p19-68%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.22.20024927-p19-68%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.22.20024927-p19-68%3.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.22.20024927-p19-68%4.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.22.20024927-p19-68%5.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.22.20024927-p20-70%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.22.20024927-p20-70%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.22.20024927-p20-70%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.22.20024927-p20-70%3.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.23.20026856-p17-115%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.23.20026856-p17-115%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.23.20026856-p17-115%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.23.20026856-p17-115%3.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.23.20026856-p17-115%4.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.23.20026856-p17-115%5.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.24.20027052-p8-73%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.24.20027052-p8-73%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.24.20027052-p8-73%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.24.20027052-p8-73%3.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.24.20027201-p19-669.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.24.20027201-p19-670.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p23-108%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p23-108%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p23-108%10.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p23-108%11.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p23-108%12.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p23-108%13.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p23-108%14.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p23-108%15.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p23-108%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p23-108%3.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p23-108%4.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p23-108%5.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p23-108%6.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p23-108%7.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p23-108%8.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p23-108%9.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p24-111%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p24-111%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p24-111%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p24-111%3.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p24-111%4.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p24-111%5.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p24-111%6.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p24-111%7.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p24-111%8.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20021568-p24-111%9.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20027763-p15-53%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.25.20027763-p15-53%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.26.20026989-p34-114_1%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.26.20026989-p34-114_1%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.26.20026989-p34-114_2%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.26.20026989-p34-114_2%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.26.20027938-p6-80_1%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.26.20027938-p6-80_1%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.26.20027938-p6-80_2%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.26.20027938-p6-80_2%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.26.20027938-p6-80_3%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.26.20027938-p6-80_3%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.27.20027557-p25-137%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.27.20027557-p25-137%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.27.20027557-p25-137%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.27.20027557-p25-137%3.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.27.20027557-p25-137%4.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.28.20029025-p23-182.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.02.28.20029025-p23-183.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.01.20029769-p21-73_1%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.01.20029769-p21-73_1%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.01.20029769-p21-73_1%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.01.20029769-p21-73_2%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.01.20029769-p21-73_2%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.01.20029769-p21-73_2%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.01.20029769-p21-73_3.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.01.20029769-p21-73_4.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.03.20030353-p17-106%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.03.20030353-p17-106%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.03.20030353-p17-106%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.03.20030775-p10-88%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.03.20030775-p10-88%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.03.20030775-p11-91.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.03.20030775-p12-93%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.03.20030775-p12-93%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20026005-p12-1946%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20026005-p12-1946%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20026005-p12-1946%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20026005-p12-1946%3.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20026005-p12-1946%4.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20026005-p12-1946%5.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20030395-p27-108%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20030395-p27-108%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20030395-p27-108%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20030395-p27-108%3.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20030395-p27-108%4.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20030395-p27-108%5.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20030395-p27-108%6.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20030395-p27-108%7.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20030395-p27-108%8.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20031039-p23-97_1%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20031039-p23-97_1%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20031039-p23-97_1%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20031039-p23-97_2%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20031039-p23-97_2%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20031039-p23-97_2%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20031047-p12-81%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20031047-p12-81%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20031047-p12-81%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20031047-p12-81%3.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20031047-p13-84%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20031047-p13-84%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20031047-p13-84%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20031047-p13-84%3.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20031047-p13-84%4.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20031047-p13-84%5.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20031047-p14-87%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.04.20031047-p14-87%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.07.20031393-p7-50%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.07.20031393-p7-50%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.07.20031393-p7-50%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.07.20031393-p7-50%3.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.08.20031658-p15-103.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.08.20031658-p15-104.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.08.20031658-p15-105.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.08.20031658-p15-106.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.09.20033118-p20-93%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.09.20033118-p20-93%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.09.20033118-p20-93%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.09.20033118-p20-93%3.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.10.20032136-p34-118_1%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.10.20032136-p34-118_1%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.10.20032136-p34-118_2%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.10.20032136-p34-118_2%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.11.20033159-p12-45%0.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.11.20033159-p12-45%1.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.11.20033159-p12-45%2.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.11.20033159-p12-45%3.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.11.20033159-p12-45%4.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.11.20033159-p12-45%5.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.12.20027185-p8-216.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.12.20027185-p8-217.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.12.20027185-p8-218.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.12.20027185-p8-221.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.12.20034686-p17-91-3.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.12.20034686-p17-91-4.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.12.20034686-p17-91-5.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.12.20034686-p17-91-6.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.13.20035212-p23-152.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.13.20035212-p23-153.png', 0],\n",
              " ['./COVID-CT/images/CT_COVID/2020.03.13.20035212-p23-154.png', 0],\n",
              " ['./COVID-CT/images/CT_NonCOVID/14.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/15.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/33.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/43.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/44.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/59.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/81.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/82.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/102.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/103.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/104.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/114.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/115.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/116.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/117.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/118.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/120.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/158.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/171.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/174.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/226.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/227.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/294.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/354.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/361.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/378.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/381.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/382.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/383.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/385.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/575.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/576.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/577.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/578.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/579.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/580.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/585.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/586.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/587.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/672.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/673.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/704.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/705.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/706.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/781.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/782.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/921.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/956.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/957.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1029.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1030.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1058.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1059.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1060.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1061.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1062.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1065.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1093.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1094.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1099.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1100.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1101.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1115.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1123.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1124.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1221.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1239.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1240.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1277.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1305.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1306.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1307.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1308.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1309.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1310.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1312.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1313.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1328.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1330.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1331.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1332.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1333.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1335.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1336.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1463.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1561.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1562.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1575.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1576.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1577.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1638.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1702.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1845.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1846.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1868.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1888.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1889.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1920.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1921.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1922.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1923.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1924.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/1952.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/2007.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/2039.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/2040.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/2041.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/2138.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/2139.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/2140.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/2141.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/2142.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/2143.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/2144.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/2145.png', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/34.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/35%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/35%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/35%2.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/36%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/36%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/37%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/37%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/37%2.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/37%3.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/37%4.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/38%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/38%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/38%2.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/39%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/39%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/39%2.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/39%3.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/39%4.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/39%5.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/39%6.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/39%7.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/39%8.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/40%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/40%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/41.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/42.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/43%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/43%2.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/43%3.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/44%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/44%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/45.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/46.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/47.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/48.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/49%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/49%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/50.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/51%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/51%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/51%2.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/51%3.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/52%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/52%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/53.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/54%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/54%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/54%2.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/54%3.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/56%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/56%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/57%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/59%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/60.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/62.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/63%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/63%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/63%2.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/63%3.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/63%4.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/63%5.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/63%6.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/63%7.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/64.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/65%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/65%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/65%2.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/65%3.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/65%4.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/66.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/67%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/67%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/67%2.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/68.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/69%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/69%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/70%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/70%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/71%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/71%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/72.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/73.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/74.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/75%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/75%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/76%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/76%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/76%2.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/77.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/78.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/79.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/80%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/80%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/81%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/81%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/81%2.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/81%3.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/82%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/82%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/82%2.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/82%3.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/83%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/83%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/83%2.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/83%3.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/84%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/84%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/84%2.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/84%3.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/85%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/85%1.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/86.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/88.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/89%2.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/89%3.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/90.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/91%0.jpg', 1],\n",
              " ['./COVID-CT/images/CT_NonCOVID/91%1.jpg', 1]]"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 114
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "mQEUGoV0lZL9",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 35
        },
        "outputId": "d46ddb11-2ff0-4211-ae6d-c8c2dfeaa2c3"
      },
      "source": [
        "len(trainset.img_list)"
      ],
      "execution_count": 115,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "425"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 115
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "sRgFaGZwhrwO",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 53
        },
        "outputId": "b7439e3d-68cb-48d0-c6db-b952b9868d74"
      },
      "source": [
        "\"\"\"\n",
        "这个transform有随机成分，每次epoch的transform之后的得到的图片是不一样的，所以在多轮训练时，相当于数据量变大了\n",
        "transform有随机成分其实就是你裁剪时是随机裁剪的，所以每次运行这个裁剪，得到的结果是不同的，而tranform作用在每一个样本上，下次在对这个样本进行transform，得到的图片就变了\n",
        "\"\"\""
      ],
      "execution_count": 116,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "application/vnd.google.colaboratory.intrinsic": {
              "type": "string"
            },
            "text/plain": [
              "'\\n这个transform有随机成分，每次epoch的transform之后的得到的图片是不一样的，所以在多轮训练时，相当于数据量变大了\\ntransform有随机成分其实就是你裁剪时是随机裁剪的，所以每次运行这个裁剪，得到的结果是不同的，而tranform作用在每一个样本上，下次在对这个样本进行transform，得到的图片就变了\\n'"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 116
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "qn67TCdwKx4Z",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "from torch.utils.data import DataLoader\n",
        "# 构建DataLoader  \n",
        "## val_loader和train_loader做不做shuffle都行，反正都不训练了\n",
        "## drop_last = False 如果425/32不被整除，那么最后一个batch也不会扔掉，只不过最后一个batch小一点，默认就是为False \n",
        "train_loader = DataLoader(trainset, batch_size = batchsize, drop_last = False, shuffle = True)\n",
        "val_loader = DataLoader(valset, batch_size = batchsize, drop_last = False, shuffle = True)\n",
        "test_loader = DataLoader(testset, batch_size = batchsize, drop_last = False, shuffle = True)\n",
        "\n",
        "# 加载预训练模型\n",
        "import torchxrayvision as xry\n",
        "# xry.models:训练好的迁移学习的model\n",
        "# 或device=torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')  model.to(device)\n",
        "\n",
        "# num_classes = 2 二分类  in_channels = 3 输入通道是3\n",
        "model = xry.models.DenseNet(num_classes = 2, in_channels = 3).cuda()\n",
        "model_name = 'DenseNet_medical'\n",
        "\n",
        "# 执行这个以后显存会主动回收，不写这个也会回收，但是回收会比较慢，不及时\n",
        "torch.cuda.empty_cache()\n",
        "\n",
        "# 定义损失函数，二分类信息熵\n",
        "# 二分类独有的损失函数torch.nn.BCELoss(),CrossEntropyLoss是通用的\n",
        "criteria = nn.CrossEntropyLoss()\n",
        "# 定义优化器\n",
        "optimizer = optim.Adam(model.parameters(), lr = 0.001)\n",
        "\n",
        "# argmax"
      ],
      "execution_count": 117,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "LSVtO0sheORu",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 71
        },
        "outputId": "d04063a8-8b4e-483e-e347-c0f50c8d561a"
      },
      "source": [
        "# 425/32 约等于14\n",
        "print(len(train_loader))\n",
        "for batch_index, batch_samples in enumerate(train_loader):\n",
        "  print(batch_samples['img'].size())\n",
        "  print(batch_samples['img'][0].size())\n",
        "  break\n"
      ],
      "execution_count": 118,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "14\n",
            "torch.Size([32, 3, 224, 224])\n",
            "torch.Size([3, 224, 224])\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "DZkwTsBBKx4m",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "import pdb\n",
        "\n",
        "#使用GPU\n",
        "device = 'cuda'\n",
        "\n",
        "# 训练\n",
        "def train(optimizer, epoch, model, train_loader, modelname, criteria):\n",
        "    model.train()\n",
        "    train_loss = 0\n",
        "    train_correct = 0\n",
        "    \n",
        "    for batch_index, batch_samples in enumerate(train_loader):\n",
        "        # 将数据放到device中\n",
        "        data, target = batch_samples['img'].to(device),batch_samples['label'].to(device)\n",
        "        # 前向传播\n",
        "        output = model(data)\n",
        "        # 计算损失函数\n",
        "        loss =criteria(output, target.long())\n",
        "        # 累积损失\n",
        "        train_loss += loss\n",
        "        # 清空上一轮梯度\n",
        "        optimizer.zero_grad()\n",
        "        # 反向传播\n",
        "        ## 整个batch的loss\n",
        "        loss.backward()\n",
        "        # 参数更新\n",
        "        optimizer.step()\n",
        "        \n",
        "        # 得到预测结果\n",
        "        # output是 batch*2维度的，设置keepdim=True，返回batch*1维度，否则返回batch这一个维度\n",
        "        # 下面target是一维的，所以这里不用keepdim=True也行，不用keepdim=True的话下面就不需要view_as了\n",
        "        pred = output.argmax(dim = 1,keepdim = True)\n",
        "        # 累加预测与标签相等的次数\n",
        "        # eq与==效果一样，view_as是将target变成pred的形状\n",
        "        # target\n",
        "        train_correct += pred.eq(target.long().view_as(pred)).sum().item()\n",
        "  \n",
        "\n",
        "        \n",
        "    # 显示训练结果\n",
        "    ## len(train_loader.dataset)=425\n",
        "    print('训练集：平均loss:{:.4f},准确率:{} / {} ({:.0f}%)'.format(train_loss / len(train_loader.dataset),\n",
        "                                                           train_correct,len(train_loader.dataset),\n",
        "                                                            100* train_correct / len(train_loader.dataset)))\n",
        "    # 返回一次epoch的平均误差\n",
        "    return train_loss / len(train_loader.dataset)"
      ],
      "execution_count": 119,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "Uoux4fIMKx40",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "import torch.nn.functional as F\n",
        "\n",
        "# 验证  \n",
        "## 验证和测试其实基本差不多\n",
        "## val主要返回我们每次训练的loss\n",
        "def val(model, val_loader, criteria):\n",
        "    # 需要进行eval()\n",
        "    model.eval()\n",
        "    val_loss, correct =0, 0\n",
        "    \n",
        "    # 不需要计算模型梯度\n",
        "    with torch.no_grad():\n",
        "        predlist, scorelist, targetlist = [], [] ,[]\n",
        "        # 预测\n",
        "        for batch_index, batch_sample in enumerate(val_loader):\n",
        "            data, target = batch_sample['img'].to(device),batch_sample['label'].to(device)\n",
        "            # 前向传播\n",
        "            output = model(data)\n",
        "            val_loss += criteria(output, target.long())\n",
        "            # 计算score, 使用softmax，行的和为1\n",
        "            score = F.softmax(output, dim = 1)\n",
        "            # pred是一个batch\n",
        "            pred =output.argmax(dim = 1,keepdim=True)\n",
        "            correct += pred.eq(target.long().view_as(pred)).sum().item()\n",
        "\n",
        "            # 由GPU放到CPU中\n",
        "            # 转成cpu以后才能转numpy，gpu的张量无法直接转numpy  numpy只能用gpu\n",
        "            # 将pred放到predlist\n",
        "            predlist = np.append(predlist, pred.cpu().numpy())\n",
        "            # softmax求不同label的概率，因为有2个label，所以有2个列0,1  1这个位置就是等于NonCOVID的概率\n",
        "            scorelist = np.append(scorelist, score.cpu().numpy()[:,1])\n",
        "            targetlist = np.append(targetlist, target.long().cpu().numpy())\n",
        "        return targetlist,scorelist,predlist,val_loss / len(val_loader.dataset)"
      ],
      "execution_count": 120,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "UBDsj-u-Kx5F",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "\n",
        "# 测试   一次epoch\n",
        "## 返回训练的成果\n",
        "def test(model, test_loader):\n",
        "    # 需要进行eval()\n",
        "    model.eval()\n",
        "    \n",
        "    # 不需要计算模型梯度\n",
        "    with torch.no_grad():\n",
        "        predlist, scorelist, targetlist = [], [] ,[]\n",
        "        # 预测\n",
        "        for batch_index, batch_sample in enumerate(val_loader):\n",
        "            data, target = batch_sample['img'].to(device),batch_sample['label'].to(device)\n",
        "            # 前向传播\n",
        "            output = model(data)\n",
        "            # 计算score, 使用softmax，行的和为1\n",
        "            score = F.softmax(output, dim = 1)\n",
        "            # pred是一个batch\n",
        "            pred =output.argmax(dim = 1,keepdim=True)\n",
        "            \n",
        "            # 由GPU放到CPU中\n",
        "            # 转成cpu以后才能转numpy，gpu的张量无法直接转numpy  numpy只能用gpu\n",
        "            # 将pred放到predlist\n",
        "            predlist = np.append(predlist, pred.cpu().numpy())\n",
        "            # softmax求不同label的概率，因为有2个label，所以有2个列0,1   1这个位置就是等于NonCOVID的概率\n",
        "            scorelist = np.append(scorelist, score.cpu().numpy()[:,1])\n",
        "            targetlist = np.append(targetlist, target.long().cpu().numpy())\n",
        "        return targetlist,scorelist,predlist"
      ],
      "execution_count": 121,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "n8yic3FGKx5R",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "outputId": "352e583e-1beb-455f-b9fa-4fd81717cb08"
      },
      "source": [
        "# 训练\n",
        "\n",
        "for epoch in range(total_epoch):\n",
        "    # 进行一次epoch\n",
        "    train_loss = train(optimizer, epoch, model, train_loader, model_name, criteria)\n",
        "    # 用验证集来验证\n",
        "    targetlist, scorelist, predlist, val_loss = val(model, val_loader, criteria)\n",
        "    # 打印真实结果\n",
        "    print('Target:',targetlist)\n",
        "    # 输出预测label=1的概率\n",
        "    print('Score:',scorelist)\n",
        "    # 输出预测结果\n",
        "    print('Predict:',predlist)\n",
        "    \n",
        "    # 模型保存 epoch5次保存一次\n",
        "    if (epoch+1) % 5 == 0:\n",
        "        torch.save(model.state_dict(), 'covid_detection.pt')"
      ],
      "execution_count": 122,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "训练集：平均loss:0.0226,准确率:275 / 425 (65%)\n",
            "Target: [1. 1. 1. 1. 0. 0. 1. 0. 1. 0. 0. 0. 1. 1. 0. 0. 1. 1. 0. 0. 1. 0. 0. 1.\n",
            " 0. 1. 1. 0. 1. 1. 0. 1. 1. 0. 0. 0. 0. 1. 1. 0. 1. 0. 1. 1. 0. 1. 1. 1.\n",
            " 1. 1. 1. 1. 0. 0. 1. 0. 1. 1. 1. 0. 1. 0. 1. 0. 0. 0. 1. 0. 1. 0. 1. 1.\n",
            " 0. 0. 1. 1. 0. 1. 0. 1. 0. 1. 0. 0. 0. 1. 0. 0. 1. 1. 0. 1. 0. 0. 0. 0.\n",
            " 0. 1. 0. 1. 0. 0. 0. 0. 0. 0. 1. 1. 0. 0. 0. 1. 1. 1. 0. 1. 0. 1.]\n",
            "Score: [0.09118414 0.99999988 0.81910962 0.17602746 0.23922449 0.51927054\n",
            " 0.51413786 0.04788554 0.53443336 0.65393209 0.05543606 0.45047086\n",
            " 0.28864041 0.4551619  0.98035079 0.99967456 0.06572429 0.15380085\n",
            " 0.59817356 0.01126612 0.1211652  0.1131165  0.99592531 0.8974337\n",
            " 0.36147887 0.31073284 0.33252046 0.33543426 0.91224855 0.97790158\n",
            " 0.42042732 0.32231095 0.12552296 0.98679197 0.99861455 0.27639046\n",
            " 0.43410471 0.05214434 0.31776932 0.26435101 0.40425837 0.27780324\n",
            " 0.88987815 0.99999976 0.03306085 0.42116582 0.10934537 0.73721308\n",
            " 0.5426234  0.06437314 0.98820323 0.92707169 0.35785607 0.32368317\n",
            " 0.14539519 0.73203993 0.15663561 0.67443955 0.24501644 0.02952925\n",
            " 0.24652514 0.14801703 0.90673155 0.99396694 0.3490755  0.41135508\n",
            " 0.30414504 0.63304925 0.69649529 0.07761867 0.47296149 0.96563148\n",
            " 0.98107499 0.03673312 0.08404226 0.53042167 0.49307436 0.08601379\n",
            " 0.0776108  0.38489655 0.67893535 0.41920418 0.11170164 0.99963009\n",
            " 0.14073448 0.09959696 0.08547722 0.50150239 0.32271874 0.21508399\n",
            " 0.39454609 0.7929315  0.68496096 0.35389969 0.35622424 0.36815104\n",
            " 0.94931042 0.11345048 0.2913819  0.06426851 0.18934186 0.58965784\n",
            " 0.5665924  0.99416524 0.09619275 0.79017806 0.11537613 0.58885539\n",
            " 0.35320851 0.63884056 0.74088383 0.56962216 0.61127341 0.55967265\n",
            " 0.70969468 0.53170866 0.71581161 0.09039415]\n",
            "Predict: [0. 1. 1. 0. 0. 1. 1. 0. 1. 1. 0. 0. 0. 0. 1. 1. 0. 0. 1. 0. 0. 0. 1. 1.\n",
            " 0. 0. 0. 0. 1. 1. 0. 0. 0. 1. 1. 0. 0. 0. 0. 0. 0. 0. 1. 1. 0. 0. 0. 1.\n",
            " 1. 0. 1. 1. 0. 0. 0. 1. 0. 1. 0. 0. 0. 0. 1. 1. 0. 0. 0. 1. 1. 0. 0. 1.\n",
            " 1. 0. 0. 1. 0. 0. 0. 0. 1. 0. 0. 1. 0. 0. 0. 1. 0. 0. 0. 1. 1. 0. 0. 0.\n",
            " 1. 0. 0. 0. 0. 1. 1. 1. 0. 1. 0. 1. 0. 1. 1. 1. 1. 1. 1. 1. 1. 0.]\n",
            "训练集：平均loss:0.0202,准确率:293 / 425 (69%)\n",
            "Target: [0. 1. 0. 0. 1. 1. 0. 1. 0. 1. 0. 0. 0. 1. 0. 1. 0. 1. 1. 1. 1. 1. 0. 0.\n",
            " 0. 1. 0. 0. 0. 0. 1. 1. 1. 1. 0. 1. 1. 0. 0. 1. 1. 1. 1. 1. 0. 0. 1. 0.\n",
            " 0. 1. 0. 1. 0. 0. 1. 1. 1. 0. 1. 0. 0. 0. 0. 0. 1. 0. 1. 1. 0. 0. 0. 0.\n",
            " 0. 1. 1. 0. 1. 0. 0. 1. 0. 0. 1. 1. 0. 0. 0. 1. 1. 0. 0. 1. 0. 0. 0. 1.\n",
            " 0. 0. 0. 1. 1. 1. 0. 1. 1. 1. 1. 1. 1. 0. 1. 1. 0. 1. 1. 1. 0. 0.]\n",
            "Score: [0.674721   0.74977046 0.89000493 0.37341198 0.4581328  0.97418189\n",
            " 0.37986204 0.33538961 0.31418845 0.50069463 0.89250499 0.39698288\n",
            " 0.9691     0.43167332 0.9564507  0.61324966 0.98530072 0.32951203\n",
            " 0.54799181 0.77257198 0.47648448 0.68359095 0.50839531 0.36646107\n",
            " 0.89535034 0.74388301 0.95145655 0.60432678 0.23536906 0.62462664\n",
            " 0.57149631 0.82012695 0.4538216  0.52100456 0.81463414 0.5172109\n",
            " 0.58519369 0.68123299 0.89699757 0.51950794 0.76915079 0.3869141\n",
            " 0.6877268  0.66598755 0.98217875 0.89311159 0.56289744 0.36274078\n",
            " 0.618828   0.79371113 0.79198408 0.5868426  0.93985522 0.38185847\n",
            " 0.77656978 0.79175442 0.66442221 0.63962519 0.54892147 0.93951291\n",
            " 0.27537036 0.85943532 0.84469962 0.87299943 0.84758449 0.91720295\n",
            " 0.47377303 0.66658807 0.41781488 0.95369059 0.39366937 0.96876401\n",
            " 0.93080777 0.54332662 0.60813135 0.66095775 0.52950078 0.67646408\n",
            " 0.9075278  0.45974138 0.89421296 0.92609364 0.73974538 0.53941476\n",
            " 0.85510582 0.3653169  0.91449046 0.4959712  0.93035489 0.94665724\n",
            " 0.91052604 0.56795818 0.66879505 0.84491324 0.61026281 0.84058368\n",
            " 0.65981811 0.9234162  0.74066573 0.75988042 0.65790021 0.52399749\n",
            " 0.71598107 0.60389096 0.55493122 0.49679491 0.63303667 0.5591076\n",
            " 0.72505879 0.98098469 0.72573179 0.54405677 0.92524981 0.74360907\n",
            " 0.89688265 0.80947232 0.61052233 0.70034581]\n",
            "Predict: [1. 1. 1. 0. 0. 1. 0. 0. 0. 1. 1. 0. 1. 0. 1. 1. 1. 0. 1. 1. 0. 1. 1. 0.\n",
            " 1. 1. 1. 1. 0. 1. 1. 1. 0. 1. 1. 1. 1. 1. 1. 1. 1. 0. 1. 1. 1. 1. 1. 0.\n",
            " 1. 1. 1. 1. 1. 0. 1. 1. 1. 1. 1. 1. 0. 1. 1. 1. 1. 1. 0. 1. 0. 1. 0. 1.\n",
            " 1. 1. 1. 1. 1. 1. 1. 0. 1. 1. 1. 1. 1. 0. 1. 0. 1. 1. 1. 1. 1. 1. 1. 1.\n",
            " 1. 1. 1. 1. 1. 1. 1. 1. 1. 0. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]\n",
            "训练集：平均loss:0.0194,准确率:290 / 425 (68%)\n",
            "Target: [1. 0. 1. 1. 0. 1. 1. 1. 0. 0. 0. 0. 0. 1. 0. 0. 1. 0. 1. 0. 0. 0. 1. 0.\n",
            " 0. 0. 0. 1. 1. 0. 0. 0. 1. 1. 1. 0. 0. 0. 0. 0. 1. 0. 1. 1. 1. 0. 1. 0.\n",
            " 0. 1. 1. 0. 1. 1. 1. 0. 0. 1. 0. 0. 0. 0. 1. 1. 1. 1. 1. 0. 1. 0. 1. 0.\n",
            " 1. 1. 1. 1. 0. 0. 1. 1. 1. 1. 0. 0. 0. 0. 0. 0. 1. 1. 0. 1. 0. 1. 0. 0.\n",
            " 0. 1. 0. 0. 0. 1. 1. 0. 1. 1. 1. 1. 1. 0. 1. 0. 0. 0. 1. 1. 1. 1.]\n",
            "Score: [0.95369959 0.26759198 0.29224339 0.28672534 0.65905589 0.76072788\n",
            " 0.18297969 0.39572147 0.68467242 0.52352589 0.17727253 0.8400988\n",
            " 0.66561085 0.99996018 0.34506482 0.94446301 0.78327411 0.77846104\n",
            " 0.9931044  0.40494725 0.22672063 0.349572   0.81603235 0.46748468\n",
            " 0.02840504 0.07255469 0.99992859 0.94175857 0.99999475 0.42270717\n",
            " 0.47733444 0.29246277 0.5841893  0.99661773 0.92639321 0.13274495\n",
            " 0.99991107 0.47333646 0.93667287 0.55200773 0.70406705 0.37799433\n",
            " 0.49063253 0.99999976 0.75062597 0.07906093 0.99999762 0.02338169\n",
            " 0.46798411 0.9999733  0.99184728 0.54974729 0.07275394 0.24104236\n",
            " 1.         0.85204822 0.13270141 0.82311589 0.34068045 0.46882436\n",
            " 0.46741319 0.1081052  0.94459265 0.99165666 0.98403281 0.88271368\n",
            " 0.72019643 0.26165703 0.99530101 0.541623   0.99997091 0.18148065\n",
            " 0.44790536 0.77509373 0.68651891 0.72929567 0.51294589 0.37924165\n",
            " 0.80611211 0.84933788 0.18488617 0.90684861 0.25983086 0.63667595\n",
            " 0.42122471 0.13680108 0.95232075 0.39271429 0.99997735 0.59140056\n",
            " 0.54549098 0.86657554 0.02990962 0.74333358 0.71845055 0.99952197\n",
            " 0.10821941 0.98573977 0.02195915 0.99780446 0.20781405 0.2473637\n",
            " 0.98931128 0.99972302 0.97614586 0.37675035 0.84991211 0.61319649\n",
            " 0.18720077 0.94988763 0.99139673 0.36681718 0.43166351 0.36633387\n",
            " 0.80210757 0.46889251 0.67226636 0.61290699]\n",
            "Predict: [1. 0. 0. 0. 1. 1. 0. 0. 1. 1. 0. 1. 1. 1. 0. 1. 1. 1. 1. 0. 0. 0. 1. 0.\n",
            " 0. 0. 1. 1. 1. 0. 0. 0. 1. 1. 1. 0. 1. 0. 1. 1. 1. 0. 0. 1. 1. 0. 1. 0.\n",
            " 0. 1. 1. 1. 0. 0. 1. 1. 0. 1. 0. 0. 0. 0. 1. 1. 1. 1. 1. 0. 1. 1. 1. 0.\n",
            " 0. 1. 1. 1. 1. 0. 1. 1. 0. 1. 0. 1. 0. 0. 1. 0. 1. 1. 1. 1. 0. 1. 1. 1.\n",
            " 0. 1. 0. 1. 0. 0. 1. 1. 1. 0. 1. 1. 0. 1. 1. 0. 0. 0. 1. 0. 1. 1.]\n",
            "训练集：平均loss:0.0209,准确率:292 / 425 (69%)\n",
            "Target: [1. 1. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 1. 1. 1. 1. 0. 0. 1. 1. 1. 1. 0. 0.\n",
            " 1. 0. 1. 0. 0. 1. 1. 0. 0. 0. 0. 0. 1. 0. 0. 1. 0. 1. 0. 0. 0. 0. 1. 1.\n",
            " 1. 0. 0. 1. 0. 0. 0. 0. 1. 1. 1. 0. 1. 1. 1. 0. 0. 0. 1. 1. 1. 0. 0. 0.\n",
            " 0. 0. 0. 0. 1. 1. 0. 1. 1. 1. 0. 0. 0. 0. 1. 1. 1. 1. 0. 0. 1. 1. 1. 0.\n",
            " 1. 1. 0. 1. 1. 1. 1. 1. 0. 1. 1. 1. 1. 1. 0. 1. 0. 1. 0. 1. 0. 0.]\n",
            "Score: [1.43111959e-01 6.04226768e-01 1.42647112e-02 1.19460616e-02\n",
            " 2.26850703e-01 5.30457012e-02 2.21008621e-03 1.96719110e-01\n",
            " 4.41278145e-03 2.21083835e-01 8.07126984e-03 2.45867930e-02\n",
            " 6.06671162e-02 5.45772493e-01 5.15094995e-01 1.80229217e-01\n",
            " 2.48120666e-01 3.12992674e-03 3.24938539e-03 9.42673922e-01\n",
            " 1.08762160e-02 6.00297630e-01 8.34417999e-01 8.06810614e-03\n",
            " 6.35218620e-01 1.55475378e-01 1.94802135e-03 5.02697267e-02\n",
            " 2.65381802e-02 8.17472219e-01 6.56923711e-01 3.58182609e-01\n",
            " 3.37260799e-03 7.31380641e-01 9.21637565e-02 1.31608739e-01\n",
            " 6.93687439e-01 7.46352179e-03 1.31512026e-03 4.87557352e-01\n",
            " 4.52165259e-03 6.71556771e-01 5.92114590e-02 9.13555324e-02\n",
            " 6.28715134e-05 1.15158651e-02 3.68786324e-03 8.10930192e-01\n",
            " 2.66899522e-02 8.83617252e-03 8.72441530e-02 9.32221353e-01\n",
            " 6.19826853e-01 2.81048194e-03 6.69018555e-05 3.70423198e-01\n",
            " 9.52381350e-04 1.37603970e-03 9.42457318e-01 3.71266622e-04\n",
            " 3.53859141e-02 4.31103975e-01 8.56865764e-01 8.11943319e-05\n",
            " 2.14214008e-02 5.58703020e-02 5.88407934e-01 5.32592714e-01\n",
            " 7.35816313e-03 1.52933240e-01 1.79010835e-02 1.23031135e-03\n",
            " 1.65204314e-04 1.76573667e-04 7.84344040e-03 6.42967410e-03\n",
            " 7.01523662e-01 8.46624613e-01 1.21765658e-01 8.92193079e-01\n",
            " 5.37080288e-01 6.96702348e-03 2.67931610e-01 1.08092012e-04\n",
            " 4.40380871e-01 2.52548885e-02 2.48354420e-01 6.61092103e-01\n",
            " 3.18057597e-01 1.73298195e-01 8.01303744e-01 7.24670351e-01\n",
            " 6.61100507e-01 1.17911763e-01 6.51972353e-01 1.24965422e-01\n",
            " 6.82869732e-01 8.20421100e-01 9.06722844e-01 8.41378629e-01\n",
            " 1.07699877e-03 2.31734946e-01 4.85619396e-01 1.74292833e-01\n",
            " 6.49374425e-02 2.76442617e-01 2.77442648e-03 3.25604863e-02\n",
            " 7.21579611e-01 6.88786983e-01 3.78876254e-02 1.38154635e-02\n",
            " 5.58822677e-02 2.14519398e-03 3.89114842e-02 2.52286368e-03\n",
            " 3.60123575e-01 2.11434931e-01]\n",
            "Predict: [0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 1. 0. 0. 0. 0. 1. 0. 1. 1. 0.\n",
            " 1. 0. 0. 0. 0. 1. 1. 0. 0. 1. 0. 0. 1. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 1.\n",
            " 0. 0. 0. 1. 1. 0. 0. 0. 0. 0. 1. 0. 0. 0. 1. 0. 0. 0. 1. 1. 0. 0. 0. 0.\n",
            " 0. 0. 0. 0. 1. 1. 0. 1. 1. 0. 0. 0. 0. 0. 0. 1. 0. 0. 1. 1. 1. 0. 1. 0.\n",
            " 1. 1. 1. 1. 0. 0. 0. 0. 0. 0. 0. 0. 1. 1. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
            "训练集：平均loss:0.0191,准确率:302 / 425 (71%)\n",
            "Target: [0. 1. 1. 0. 1. 1. 1. 1. 1. 0. 0. 1. 0. 1. 1. 0. 1. 1. 0. 1. 0. 0. 0. 1.\n",
            " 1. 0. 0. 0. 1. 0. 0. 0. 0. 0. 1. 1. 0. 0. 0. 0. 1. 1. 1. 1. 0. 1. 0. 0.\n",
            " 1. 0. 1. 1. 1. 1. 0. 0. 0. 0. 1. 1. 1. 0. 1. 0. 0. 1. 1. 0. 0. 0. 0. 1.\n",
            " 1. 0. 1. 0. 0. 0. 1. 1. 1. 0. 0. 1. 0. 0. 1. 1. 1. 0. 0. 0. 0. 1. 0. 1.\n",
            " 1. 1. 1. 0. 0. 1. 0. 0. 1. 0. 1. 0. 1. 1. 1. 1. 0. 1. 0. 0. 0. 1.]\n",
            "Score: [0.07960454 0.62693995 0.09753471 0.41419366 0.04393334 0.57192045\n",
            " 0.51613307 0.6430338  0.45590931 0.32727197 0.49925807 0.5104773\n",
            " 0.07195351 0.64214081 0.5217219  0.03024109 0.68259412 0.25732639\n",
            " 0.02776613 0.54685551 0.2694315  0.01331648 0.12328701 0.63112211\n",
            " 0.79667652 0.71610349 0.04868978 0.01846073 0.5997436  0.02897066\n",
            " 0.01320073 0.0262816  0.53299737 0.25525007 0.41280028 0.63078016\n",
            " 0.34266537 0.08070309 0.4966853  0.31871814 0.0344853  0.58024263\n",
            " 0.08718179 0.01801472 0.2591953  0.5226441  0.28740093 0.5632776\n",
            " 0.6827442  0.15987229 0.03986493 0.02967701 0.59866196 0.09872423\n",
            " 0.11504246 0.42627421 0.21903913 0.10707695 0.17108101 0.45214933\n",
            " 0.45681366 0.29162577 0.67920274 0.41019768 0.19243158 0.20780917\n",
            " 0.83604485 0.33438122 0.38787851 0.08938398 0.45032775 0.4088302\n",
            " 0.60924423 0.12814242 0.969872   0.31783625 0.39886755 0.49326897\n",
            " 0.58073938 0.68216741 0.44959074 0.26411295 0.04681888 0.21913081\n",
            " 0.22628966 0.46564114 0.06174639 0.26150671 0.48190454 0.26032895\n",
            " 0.22515973 0.65870231 0.12404757 0.17792229 0.49749658 0.62654775\n",
            " 0.74065971 0.6590215  0.80359614 0.58010554 0.58908504 0.37752804\n",
            " 0.00320758 0.28657007 0.39238569 0.00180407 0.49310923 0.04888786\n",
            " 0.33253315 0.14706549 0.76752985 0.73284203 0.41511703 0.67363566\n",
            " 0.578852   0.42493147 0.84948176 0.96196443]\n",
            "Predict: [0. 1. 0. 0. 0. 1. 1. 1. 0. 0. 0. 1. 0. 1. 1. 0. 1. 0. 0. 1. 0. 0. 0. 1.\n",
            " 1. 1. 0. 0. 1. 0. 0. 0. 1. 0. 0. 1. 0. 0. 0. 0. 0. 1. 0. 0. 0. 1. 0. 1.\n",
            " 1. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 1. 0. 0. 0. 0. 0.\n",
            " 1. 0. 1. 0. 0. 0. 1. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 1.\n",
            " 1. 1. 1. 1. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 1. 0. 1. 1. 0. 1. 1.]\n",
            "训练集：平均loss:0.0183,准确率:311 / 425 (73%)\n",
            "Target: [0. 0. 0. 1. 1. 1. 1. 0. 0. 1. 1. 1. 1. 0. 1. 0. 1. 0. 0. 0. 0. 0. 1. 0.\n",
            " 1. 0. 0. 0. 0. 0. 0. 1. 1. 0. 1. 1. 0. 1. 1. 1. 1. 0. 1. 0. 1. 0. 0. 1.\n",
            " 0. 1. 1. 1. 0. 1. 1. 1. 0. 0. 0. 1. 1. 0. 0. 0. 0. 0. 1. 1. 1. 1. 1. 1.\n",
            " 0. 1. 1. 1. 0. 1. 0. 0. 1. 0. 1. 1. 0. 0. 0. 0. 1. 0. 1. 0. 1. 0. 0. 1.\n",
            " 0. 1. 0. 0. 1. 1. 1. 0. 0. 0. 1. 1. 0. 0. 0. 0. 1. 1. 0. 1. 0. 1.]\n",
            "Score: [2.01068282e-01 2.18108366e-03 3.37034255e-01 1.38470709e-01\n",
            " 8.81397367e-01 6.47818267e-01 7.41458952e-01 9.61335376e-02\n",
            " 7.60543272e-02 5.14416993e-01 7.56848156e-01 5.87960184e-01\n",
            " 4.76036966e-01 2.35410617e-03 3.21307212e-01 4.30016853e-02\n",
            " 5.61579525e-01 8.31147254e-01 1.44760042e-01 2.04210281e-01\n",
            " 2.37899385e-02 8.77656415e-02 9.31787789e-01 7.20041171e-02\n",
            " 7.04724967e-01 3.13050210e-01 7.88688436e-02 7.91994572e-01\n",
            " 1.88376531e-01 1.51736215e-01 3.26219061e-03 6.14896894e-01\n",
            " 6.70072377e-01 1.53755844e-01 4.17360604e-01 6.25242889e-02\n",
            " 2.21891239e-01 1.72952846e-01 5.95242798e-01 5.62142720e-03\n",
            " 2.37725869e-01 7.66992807e-01 1.51767313e-01 3.20556700e-01\n",
            " 6.72604084e-01 3.52035254e-01 1.57100543e-01 2.58622050e-01\n",
            " 2.82001436e-01 9.67721999e-01 8.56129766e-01 1.03129435e-03\n",
            " 2.44552419e-01 6.51576400e-01 8.26644957e-01 4.42262858e-01\n",
            " 3.23268771e-01 5.86838983e-02 6.58084035e-01 9.35871661e-01\n",
            " 6.91544116e-01 4.64467295e-02 1.55153066e-01 5.27663767e-01\n",
            " 8.30441892e-01 8.57639253e-01 4.61394548e-01 5.83256125e-01\n",
            " 8.50904405e-01 7.67756164e-01 2.91608393e-01 5.78496993e-01\n",
            " 4.45507430e-02 6.66493654e-01 7.20647752e-01 5.01443911e-03\n",
            " 3.67375277e-02 8.52101505e-01 4.16548461e-01 8.45235139e-02\n",
            " 6.18528545e-01 5.54912448e-01 5.38904548e-01 2.41736829e-01\n",
            " 5.41030169e-01 4.53971833e-01 4.01173979e-02 2.72110254e-01\n",
            " 7.49924839e-01 3.04100540e-04 7.88129747e-01 3.25114653e-02\n",
            " 5.18279791e-01 1.72809511e-01 5.68263650e-01 6.86484396e-01\n",
            " 2.97948923e-02 7.62130857e-01 1.89721212e-01 5.88400543e-01\n",
            " 9.74564314e-01 2.72777140e-01 4.94145304e-01 2.90906876e-01\n",
            " 8.12151954e-02 3.85405302e-01 7.91949511e-01 1.32609159e-01\n",
            " 7.94917285e-01 1.02223277e-01 1.88668847e-01 1.36794075e-01\n",
            " 7.41634965e-01 9.22043249e-02 3.55974317e-01 2.42495835e-01\n",
            " 3.50484878e-01 3.20110947e-01]\n",
            "Predict: [0. 0. 0. 0. 1. 1. 1. 0. 0. 1. 1. 1. 0. 0. 0. 0. 1. 1. 0. 0. 0. 0. 1. 0.\n",
            " 1. 0. 0. 1. 0. 0. 0. 1. 1. 0. 0. 0. 0. 0. 1. 0. 0. 1. 0. 0. 1. 0. 0. 0.\n",
            " 0. 1. 1. 0. 0. 1. 1. 0. 0. 0. 1. 1. 1. 0. 0. 1. 1. 1. 0. 1. 1. 1. 0. 1.\n",
            " 0. 1. 1. 0. 0. 1. 0. 0. 1. 1. 1. 0. 1. 0. 0. 0. 1. 0. 1. 0. 1. 0. 1. 1.\n",
            " 0. 1. 0. 1. 1. 0. 0. 0. 0. 0. 1. 0. 1. 0. 0. 0. 1. 0. 0. 0. 0. 0.]\n",
            "训练集：平均loss:0.0190,准确率:301 / 425 (71%)\n",
            "Target: [0. 0. 0. 0. 1. 0. 1. 1. 1. 1. 0. 0. 1. 1. 0. 0. 1. 1. 1. 1. 1. 1. 0. 1.\n",
            " 0. 1. 0. 1. 0. 1. 1. 1. 0. 1. 1. 0. 0. 1. 1. 1. 0. 0. 0. 0. 1. 1. 0. 0.\n",
            " 0. 0. 1. 0. 0. 1. 1. 1. 1. 0. 0. 1. 1. 1. 0. 1. 0. 0. 0. 1. 1. 0. 0. 1.\n",
            " 0. 0. 1. 0. 1. 0. 0. 0. 1. 0. 0. 1. 0. 1. 0. 1. 0. 0. 1. 0. 1. 1. 1. 1.\n",
            " 1. 0. 0. 0. 1. 1. 1. 0. 1. 0. 1. 1. 0. 0. 0. 0. 0. 1. 0. 0. 0. 1.]\n",
            "Score: [1.91019759e-01 7.53882378e-02 3.77961174e-02 3.72090191e-01\n",
            " 4.99725848e-01 3.91850680e-01 5.31137705e-01 6.58261836e-01\n",
            " 1.45330457e-02 8.37826610e-01 1.94291472e-01 1.01965480e-02\n",
            " 4.29034501e-01 6.21962175e-02 2.41152391e-01 6.80363784e-03\n",
            " 9.17127207e-02 1.16210161e-02 6.14076853e-01 3.74261737e-01\n",
            " 6.12655222e-01 5.23314834e-01 1.11265585e-01 6.24391258e-01\n",
            " 1.41197247e-02 4.51260090e-01 1.46625796e-02 1.35816813e-01\n",
            " 5.25660850e-02 4.16433066e-02 7.68951893e-01 7.18487859e-01\n",
            " 2.48197690e-02 4.96922195e-01 9.44103420e-01 3.89783876e-04\n",
            " 2.51857955e-02 2.98824728e-01 1.56303626e-02 4.28024501e-01\n",
            " 8.78638506e-01 5.34323836e-03 2.58624032e-02 4.15119994e-03\n",
            " 6.32984102e-01 3.18187714e-01 9.52465273e-03 8.28679383e-01\n",
            " 9.22766402e-02 2.59027570e-01 6.29273772e-01 8.71652141e-02\n",
            " 1.63201184e-04 2.51693726e-01 6.98166311e-01 2.25361008e-02\n",
            " 1.21382587e-02 4.50539105e-02 8.94566774e-02 4.37233457e-03\n",
            " 4.13518727e-01 2.30656445e-01 1.55138910e-01 4.87016529e-01\n",
            " 6.47060864e-04 3.57244790e-01 9.88286454e-04 6.38479710e-01\n",
            " 5.51648021e-01 7.07974494e-01 1.98455006e-02 2.54687130e-01\n",
            " 2.51125079e-03 4.25213985e-02 3.38445395e-01 2.66349118e-04\n",
            " 7.86766708e-01 3.55149992e-02 2.87163388e-02 5.19251525e-02\n",
            " 1.57937601e-01 1.59207851e-01 6.30068555e-02 5.58774412e-01\n",
            " 7.93907821e-01 2.88813740e-01 1.30957440e-01 2.64733374e-01\n",
            " 8.42755258e-01 2.58982759e-02 4.43691075e-01 4.76377427e-05\n",
            " 7.96405077e-01 3.12723577e-01 9.45207298e-01 2.03211010e-02\n",
            " 8.92402470e-01 8.71455133e-01 1.60866380e-01 3.16102020e-02\n",
            " 8.16671491e-01 3.88265625e-02 1.81544244e-01 2.57556975e-01\n",
            " 4.48864639e-01 5.91162369e-02 3.63880657e-02 2.21410543e-02\n",
            " 1.12865590e-01 7.11234063e-02 3.38026673e-01 2.90591512e-02\n",
            " 1.00758597e-01 2.15386093e-01 4.96047968e-03 8.48259032e-02\n",
            " 2.23635864e-02 7.82242239e-01]\n",
            "Predict: [0. 0. 0. 0. 0. 0. 1. 1. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 1. 1. 0. 1.\n",
            " 0. 0. 0. 0. 0. 0. 1. 1. 0. 0. 1. 0. 0. 0. 0. 0. 1. 0. 0. 0. 1. 0. 0. 1.\n",
            " 0. 0. 1. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 1. 1. 0. 0.\n",
            " 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 1. 1. 0. 0. 0. 1. 0. 0. 0. 1. 0. 1. 0.\n",
            " 1. 1. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1.]\n",
            "训练集：平均loss:0.0187,准确率:302 / 425 (71%)\n",
            "Target: [1. 0. 0. 0. 0. 1. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 1. 0. 0. 1. 0. 0. 0. 0.\n",
            " 1. 1. 0. 0. 0. 1. 0. 0. 0. 0. 1. 0. 0. 0. 1. 1. 1. 1. 0. 0. 1. 1. 1. 1.\n",
            " 1. 1. 0. 1. 1. 0. 0. 0. 0. 1. 1. 0. 0. 0. 0. 1. 0. 1. 1. 1. 1. 0. 0. 1.\n",
            " 0. 1. 1. 1. 0. 0. 1. 1. 1. 1. 0. 0. 0. 0. 1. 1. 1. 1. 1. 0. 1. 1. 0. 1.\n",
            " 1. 1. 1. 0. 0. 1. 0. 1. 1. 1. 0. 1. 0. 1. 0. 1. 0. 1. 0. 1. 1. 1.]\n",
            "Score: [0.69055319 0.75591195 0.63262761 0.68820435 0.95836574 0.97613448\n",
            " 0.98205054 0.64376986 0.78086764 0.82815301 0.89754313 0.59634691\n",
            " 0.90348327 0.62820315 0.7676717  0.83937985 0.72460604 0.83082193\n",
            " 0.89923799 0.86028445 0.61157244 0.36132786 0.77952403 0.96118164\n",
            " 0.7905823  0.74205005 0.88608694 0.76223606 0.90995425 0.87682265\n",
            " 0.9122963  0.81512058 0.70675462 0.62267029 0.91546476 0.95329237\n",
            " 0.41021135 0.88290995 0.92329156 0.95029151 0.96002233 0.95963937\n",
            " 0.52031994 0.96066552 0.71702403 0.96023345 0.96294415 0.95371532\n",
            " 0.89132595 0.92035121 0.82916576 0.40988618 0.99053723 0.78778327\n",
            " 0.87881058 0.8353442  0.96392971 0.71057242 0.94628882 0.38176203\n",
            " 0.83067739 0.81348771 0.41878462 0.74294096 0.37374747 0.94659334\n",
            " 0.96127892 0.52379078 0.68561423 0.72742575 0.80450302 0.74578404\n",
            " 0.8178764  0.54547203 0.78752679 0.92640364 0.9592011  0.91365319\n",
            " 0.82833087 0.97442019 0.97989756 0.94315732 0.73762286 0.81194216\n",
            " 0.26656348 0.54899049 0.96608013 0.93104959 0.97178787 0.82169408\n",
            " 0.94903278 0.84930456 0.91831887 0.86568159 0.61317372 0.96407974\n",
            " 0.62228411 0.92235547 0.98925775 0.86298025 0.73986852 0.98494798\n",
            " 0.76994771 0.81196272 0.57004309 0.81069303 0.86533242 0.94510317\n",
            " 0.8369382  0.51233643 0.51675659 0.98166925 0.82629031 0.92511177\n",
            " 0.74555105 0.72687787 0.84125292 0.97331244]\n",
            "Predict: [1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 0. 1. 1.\n",
            " 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 0. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.\n",
            " 1. 1. 1. 0. 1. 1. 1. 1. 1. 1. 1. 0. 1. 1. 0. 1. 0. 1. 1. 1. 1. 1. 1. 1.\n",
            " 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 0. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.\n",
            " 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]\n",
            "训练集：平均loss:0.0197,准确率:288 / 425 (68%)\n",
            "Target: [1. 0. 1. 0. 0. 0. 0. 1. 0. 1. 1. 0. 1. 0. 0. 1. 0. 0. 1. 0. 1. 1. 1. 1.\n",
            " 0. 1. 1. 0. 1. 1. 0. 1. 0. 0. 1. 1. 1. 0. 0. 0. 1. 1. 0. 0. 1. 0. 1. 0.\n",
            " 1. 0. 0. 0. 1. 1. 0. 0. 1. 0. 0. 0. 1. 1. 0. 0. 1. 0. 1. 1. 1. 0. 1. 0.\n",
            " 1. 0. 0. 0. 1. 1. 1. 1. 1. 0. 0. 1. 1. 0. 1. 0. 0. 1. 1. 0. 1. 1. 1. 0.\n",
            " 1. 1. 1. 0. 1. 0. 1. 0. 1. 0. 0. 0. 1. 0. 0. 0. 1. 0. 0. 0. 0. 1.]\n",
            "Score: [1.24631079e-08 2.22966904e-04 2.42543065e-05 1.92216621e-03\n",
            " 6.81758706e-07 2.42514852e-05 4.32678834e-02 2.13967444e-09\n",
            " 1.10783440e-05 3.67034316e-01 1.12628402e-06 2.25408220e-10\n",
            " 7.65874029e-06 2.45956760e-02 5.94704161e-08 5.12275219e-01\n",
            " 1.84880346e-01 7.61749325e-05 2.85889171e-02 5.84932707e-08\n",
            " 3.00327986e-01 1.48257703e-01 2.63578272e-07 2.58204153e-10\n",
            " 6.89554214e-02 6.74690723e-01 1.66548416e-01 2.83129715e-08\n",
            " 2.13468164e-01 1.31964281e-01 2.91383616e-03 6.53548658e-01\n",
            " 2.44042092e-10 1.93696708e-11 7.39973187e-02 3.50596845e-01\n",
            " 5.29731750e-01 4.45413636e-04 2.18754985e-06 2.47820392e-02\n",
            " 4.71148593e-03 6.99049413e-01 9.00578860e-04 1.73640782e-08\n",
            " 6.14750683e-01 4.30864515e-03 2.01224104e-08 4.39902672e-13\n",
            " 7.77558029e-01 4.30343265e-04 4.79158480e-05 1.30431943e-09\n",
            " 1.05773361e-04 1.07142188e-08 2.73053106e-02 3.25097280e-05\n",
            " 7.03041255e-01 7.41933164e-08 3.92352289e-04 6.10687629e-12\n",
            " 5.61527047e-09 1.20621567e-04 3.87247472e-14 2.31425875e-04\n",
            " 6.39480641e-05 2.55637597e-02 5.58162391e-01 6.17767215e-01\n",
            " 3.37493092e-01 5.16286036e-07 1.55289342e-07 1.34754833e-03\n",
            " 2.05212842e-08 2.05089600e-05 3.73014792e-08 1.33393643e-10\n",
            " 6.42918169e-01 1.59760248e-07 1.82471261e-03 2.15960480e-02\n",
            " 2.28228971e-01 7.01390590e-08 1.99203248e-04 1.46839773e-06\n",
            " 7.50013113e-01 2.21688679e-04 2.38483712e-01 3.31018484e-08\n",
            " 5.22557180e-08 1.85500408e-04 2.80798809e-03 1.36597529e-01\n",
            " 2.60626376e-01 1.40523800e-04 3.65548703e-06 7.69787675e-07\n",
            " 1.01692021e-05 5.56249463e-04 3.85835990e-02 8.23755488e-02\n",
            " 7.35603809e-01 1.59977265e-02 4.16369587e-01 1.25880431e-10\n",
            " 5.91633797e-01 3.14769032e-03 1.30290090e-07 1.14563096e-04\n",
            " 6.06236141e-03 3.03051717e-09 2.55669875e-07 9.94808261e-07\n",
            " 4.39010182e-05 1.05263076e-07 2.40652025e-06 8.05482045e-02\n",
            " 6.45542508e-09 6.18561685e-01]\n",
            "Predict: [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0.\n",
            " 0. 1. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 1. 0. 0. 0. 0. 1. 0. 0. 1. 0. 0. 0.\n",
            " 1. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 1. 0. 0. 0. 0.\n",
            " 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.\n",
            " 0. 0. 0. 0. 1. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1.]\n",
            "训练集：平均loss:0.0180,准确率:304 / 425 (72%)\n",
            "Target: [0. 0. 1. 0. 1. 1. 0. 0. 1. 0. 1. 1. 0. 1. 0. 1. 0. 0. 0. 0. 0. 1. 1. 0.\n",
            " 0. 0. 1. 1. 1. 1. 1. 1. 0. 0. 1. 1. 0. 0. 1. 1. 0. 0. 1. 1. 1. 1. 0. 0.\n",
            " 0. 1. 0. 0. 0. 1. 1. 1. 0. 1. 1. 0. 1. 1. 0. 1. 1. 0. 1. 0. 1. 1. 0. 0.\n",
            " 0. 0. 1. 1. 1. 0. 0. 1. 0. 0. 0. 1. 1. 0. 1. 0. 0. 0. 0. 1. 1. 0. 0. 0.\n",
            " 1. 1. 1. 0. 1. 1. 0. 1. 0. 0. 0. 1. 1. 0. 1. 0. 0. 1. 0. 1. 0. 1.]\n",
            "Score: [1.65396258e-01 1.41508862e-01 9.58886683e-01 7.62863934e-01\n",
            " 8.09595525e-01 7.74213910e-01 1.26555497e-02 4.20202240e-02\n",
            " 8.16727936e-01 8.24138224e-01 8.05610001e-01 8.70290220e-01\n",
            " 3.20422550e-05 9.37016234e-02 6.12282520e-03 9.80593979e-01\n",
            " 1.21921254e-03 2.97736079e-01 5.74178576e-01 8.60594869e-01\n",
            " 4.01991904e-01 3.48417535e-02 9.21518147e-01 8.80911393e-05\n",
            " 3.13830882e-04 1.80377346e-02 9.58483160e-01 1.18917413e-02\n",
            " 8.88543129e-01 9.06293094e-01 8.86370778e-01 9.14423227e-01\n",
            " 5.11836959e-03 1.55860573e-01 3.37321609e-01 8.07924688e-01\n",
            " 3.94446775e-03 2.35036835e-02 8.63647401e-01 8.05609286e-01\n",
            " 9.46075670e-05 1.22890852e-01 6.91238999e-01 8.91299963e-01\n",
            " 8.01747978e-01 9.76640880e-01 1.73315376e-01 1.52751580e-02\n",
            " 5.12223840e-01 9.66216981e-01 4.95392978e-01 4.86477092e-03\n",
            " 2.46292492e-03 7.62030303e-01 8.90829086e-01 2.64607102e-01\n",
            " 5.47891498e-01 2.97493011e-01 7.78794646e-01 4.56415355e-01\n",
            " 7.24457264e-01 5.82495034e-01 4.08899516e-01 1.53134048e-01\n",
            " 8.35546434e-01 8.97806108e-01 8.14451814e-01 7.05275416e-01\n",
            " 8.24481189e-01 9.47369993e-01 4.41417187e-01 4.45219576e-01\n",
            " 6.83789909e-01 6.99017107e-01 8.38103816e-02 8.36500049e-01\n",
            " 9.71497297e-01 3.74753147e-01 7.46295810e-01 3.58484715e-01\n",
            " 4.60207403e-01 8.42164695e-01 4.51524258e-01 8.93173695e-01\n",
            " 7.68307984e-01 4.09438163e-01 6.07511640e-01 9.29283321e-01\n",
            " 5.57102859e-01 1.19517803e-01 9.99737903e-03 6.76167607e-01\n",
            " 6.95460498e-01 4.84455794e-01 5.91304719e-01 6.84469938e-01\n",
            " 6.62317753e-01 9.37374473e-01 5.48941612e-01 2.23058778e-05\n",
            " 9.68481183e-01 9.07112956e-01 3.87490145e-03 9.81065333e-01\n",
            " 5.74106574e-01 1.87838152e-02 4.58077878e-01 1.33287972e-02\n",
            " 7.17117131e-01 9.68488213e-03 1.88115954e-01 2.18380912e-04\n",
            " 8.07039857e-01 1.49083421e-01 1.22412021e-04 9.85434175e-01\n",
            " 1.92461628e-02 9.50623095e-01]\n",
            "Predict: [0. 0. 1. 1. 1. 1. 0. 0. 1. 1. 1. 1. 0. 0. 0. 1. 0. 0. 1. 1. 0. 0. 1. 0.\n",
            " 0. 0. 1. 0. 1. 1. 1. 1. 0. 0. 0. 1. 0. 0. 1. 1. 0. 0. 1. 1. 1. 1. 0. 0.\n",
            " 1. 1. 0. 0. 0. 1. 1. 0. 1. 0. 1. 0. 1. 1. 0. 0. 1. 1. 1. 1. 1. 1. 0. 0.\n",
            " 1. 1. 0. 1. 1. 0. 1. 0. 0. 1. 0. 1. 1. 0. 1. 1. 1. 0. 0. 1. 1. 0. 1. 1.\n",
            " 1. 1. 1. 0. 1. 1. 0. 1. 1. 0. 0. 0. 1. 0. 0. 0. 1. 0. 0. 1. 0. 1.]\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "MB4edR3EKx5Z",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 737
        },
        "outputId": "0d155440-058c-492a-89d1-61ef98ec15f7"
      },
      "source": [
        "# 用测试集进行测试\n",
        "# test这里就是交答案的模型\n",
        "targetlist, scorelist, predlist = test(model, test_loader)\n",
        "# 打印真实结果\n",
        "print('Target:',targetlist)\n",
        "# 输出预测label=1的概率\n",
        "print('Score:',scorelist)\n",
        "# 输出预测结果\n",
        "print('Predict:',predlist)"
      ],
      "execution_count": 123,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Target: [1. 0. 1. 0. 0. 1. 1. 1. 1. 0. 0. 0. 1. 0. 1. 1. 0. 1. 1. 0. 0. 0. 1. 0.\n",
            " 1. 0. 0. 0. 1. 1. 1. 0. 1. 0. 0. 1. 1. 0. 1. 0. 1. 1. 0. 0. 1. 1. 0. 0.\n",
            " 1. 0. 0. 1. 0. 0. 1. 0. 0. 0. 1. 0. 0. 1. 1. 1. 1. 1. 0. 1. 1. 0. 1. 1.\n",
            " 1. 0. 1. 1. 1. 0. 1. 0. 1. 0. 0. 0. 1. 0. 0. 1. 1. 1. 1. 1. 0. 0. 1. 0.\n",
            " 1. 0. 1. 0. 0. 1. 0. 0. 0. 1. 1. 0. 0. 0. 1. 0. 0. 0. 1. 1. 0. 0.]\n",
            "Score: [9.68481183e-01 4.09438163e-01 9.80593979e-01 1.80377346e-02\n",
            " 4.51524258e-01 8.70290220e-01 6.62317753e-01 6.95460558e-01\n",
            " 3.37321609e-01 4.41417128e-01 1.41508743e-01 4.45219576e-01\n",
            " 8.24481189e-01 1.19517803e-01 7.78794646e-01 7.68307984e-01\n",
            " 9.29283321e-01 9.14423227e-01 8.07924628e-01 4.01991934e-01\n",
            " 2.35036835e-02 1.22890852e-01 7.74213910e-01 2.18381741e-04\n",
            " 1.49083555e-01 5.11835981e-03 1.73315376e-01 8.60594869e-01\n",
            " 1.33288344e-02 8.05609286e-01 8.09595525e-01 5.47891557e-01\n",
            " 8.05610001e-01 9.46076543e-05 3.87492124e-03 9.37374651e-01\n",
            " 7.17117131e-01 8.24138224e-01 2.64607102e-01 1.65396214e-01\n",
            " 8.14451814e-01 2.97493011e-01 3.13830882e-04 9.68491752e-03\n",
            " 8.86370778e-01 8.88543069e-01 4.60207403e-01 4.08899516e-01\n",
            " 6.76167667e-01 6.83789909e-01 2.23059833e-05 3.48417535e-02\n",
            " 1.22412253e-04 5.12223899e-01 7.62030303e-01 3.20422259e-05\n",
            " 3.74753207e-01 9.99738369e-03 5.82495093e-01 7.62863934e-01\n",
            " 7.46295810e-01 1.88116074e-01 9.21518147e-01 9.76640880e-01\n",
            " 5.48941791e-01 9.58886683e-01 3.94446775e-03 8.93173695e-01\n",
            " 8.90829086e-01 8.80911393e-05 8.16727936e-01 8.38103518e-02\n",
            " 8.63647401e-01 1.21921138e-03 9.50623095e-01 9.71497297e-01\n",
            " 8.91300082e-01 5.74106812e-01 6.91238999e-01 4.84455794e-01\n",
            " 9.85434175e-01 2.97736079e-01 1.92462131e-02 5.74178576e-01\n",
            " 1.18917301e-02 4.58077967e-01 7.05275297e-01 8.35546434e-01\n",
            " 9.06293094e-01 1.53134048e-01 3.58484745e-01 8.36500049e-01\n",
            " 6.84469879e-01 1.55860573e-01 9.66216981e-01 4.95393038e-01\n",
            " 9.81065333e-01 5.91304600e-01 6.07511580e-01 1.52751021e-02\n",
            " 2.46291910e-03 9.58483160e-01 6.12280751e-03 1.26555022e-02\n",
            " 4.86476021e-03 9.07112956e-01 9.37016457e-02 1.87838152e-02\n",
            " 5.57102621e-01 8.97806108e-01 7.24457264e-01 4.56415266e-01\n",
            " 4.20201458e-02 6.99016869e-01 8.01747799e-01 9.47369993e-01\n",
            " 8.07039857e-01 8.42164695e-01]\n",
            "Predict: [1. 0. 1. 0. 0. 1. 1. 1. 0. 0. 0. 0. 1. 0. 1. 1. 1. 1. 1. 0. 0. 0. 1. 0.\n",
            " 0. 0. 0. 1. 0. 1. 1. 1. 1. 0. 0. 1. 1. 1. 0. 0. 1. 0. 0. 0. 1. 1. 0. 0.\n",
            " 1. 1. 0. 0. 0. 1. 1. 0. 0. 0. 1. 1. 1. 0. 1. 1. 1. 1. 0. 1. 1. 0. 1. 0.\n",
            " 1. 0. 1. 1. 1. 1. 1. 0. 1. 0. 0. 1. 0. 0. 1. 1. 1. 0. 0. 1. 1. 0. 1. 0.\n",
            " 1. 1. 1. 0. 0. 1. 0. 0. 0. 1. 0. 0. 1. 1. 1. 0. 0. 1. 1. 1. 1. 1.]\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "qACC7x8DP2jF",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        ""
      ],
      "execution_count": null,
      "outputs": []
    }
  ]
}